<include file="public/head"/>
<include file="public/scripts"/>
<style type="text/css">
    .pic-list li {
        margin-bottom: 5px;
    }
    .well {
        margin:0px 0px 0px 0px;
    }
</style>
<body>
<div class="wrap js-check-wrap">
    <?php if(isset($p_list)) { ?>
    <div style="">
        <a href="{:cmf_plugin_url('QbtOrder://AdminIndex/index')}" class="btn btn-info btn-lg">
          <span class="glyphicon glyphicon-chevron-left"></span> 返回列表
        </a>
        <h3>订单信息：</h3>
        <div class="row">
            
            <div class="col-md-10">
                <table class="table table-bordered">
                    <tr>
                        <th>订单号：</th>
                        <td>{$p_list.order_sn}</td>
                    </tr>
                    <tr>
                        <th>订单状态：</th>
                        <td>
                <?php 
                    switch($p_list['order_status']){
                        case 0:
                            echo "未确认,";
                            break;
                        case 1:
                            echo "已确认,";
                            break;                
                        case 2:
                            echo "<span style=\"color:red;\">已取消,</span>";
                            break;  
                        default:  
                            echo "<span style=\"color:red;\">无效,</span>";
                            break;              
                    }
                    switch($p_list['pay_status']){
                        case 0:
                            echo "未付款,";
                            break;
                                       
                        case 2:
                            echo "已付款,";
                            break;  
                        default:             
                    } 
                    switch($p_list['shipping_status']){
                        case 0:
                            echo "未发货";
                            break;
                        case 1:
                           echo "已发货";
                            break;                           
                        case 2:
                            echo "收货确认";
                            break;  
                        default:             
                    }                            
                ?></td>
                    </tr>
                    <tr>
                        <th>购货人：</th>
                        <td>{$p_list.username|default='匿名'}</td>
                    </tr>
                    <tr>
                        <th>下单时间：</th>
                        <td>{:date('Y-m-d H:i:s',$p_list.add_time)}</td>
                    </tr>
                    <tr>
                        <th>支付方式：</th>
                        <td>{$p_list.pay_name}</td>
                    </tr>
                    <tr>
                        <th>付款时间：</th>
                        <td><?=$p_list['pay_time']?date('Y-m-d H:i:s',$p_list['pay_time']):'未付款';?></td>
                    </tr>
                    <tr>
                        <th>配送方式：</th>
                        <td>{$p_list.shipping_name}  <a href="{:cmf_plugin_url('QbtOrder://AdminIndex/shipping?order_id='.$p_list.order_id)}">编辑</a></td>
                    </tr>
                    <tr>
                        <th>发货时间：</th>
                        <td><?=$p_list['shipping_time']?date('Y-m-d H:i:s',$p_list['shipping_time']):'未发货';?></td>
                    </tr>

                    <?php if($p_list['shipping_status'] == 1 || $p_list['shipping_status'] == 2) { ?>
                    <tr>
                        <td><div><strong>发货单号：</strong></div></td>
                        <td>{$p_list.invoice_no}</td>
                    </tr>  
                    <?php } ?> 
                </table>
            </div>
            
        </div>         
    </div>
    <?php } else { ?>
    <p>该订单暂无商品数据。。。</p>
        <a href="{:cmf_plugin_url('QbtOrder://AdminIndex/index')}" class="btn btn-info btn-lg">
          <span class="glyphicon glyphicon-chevron-left"></span> 返回列表
        </a>    
    <?php } ?>    
    <?php if(isset($p_list)) { ?>

    <div style="">
        <h3>收货人信息：</h3>
        <div class="row">
            <div class="col-md-10">
                <table class="table table-bordered">
                    <tr>
                        <th>收货人：</th>
                        <td>{$p_list.consignee}</td>
                    </tr>
                    <tr>
                        <th>地址：</th>
                        <td>{$p_list.address}</td>
                    </tr>
                    <tr>
                        <th>电话：</th>
                        <td>{$p_list.tel}</td>
                    </tr>
                </table>
            </div>
        </div>        
    </div>
    <?php } ?>
    <?php if(isset($goods_list)) { ?>
    <div  class="col-md-10">
        <h3>商品信息：</h3>
        <table align="center" class="table table-hover table-list">
            <thead>
                <tr>
                    <th>商品名称 [ 品牌 ]</th>
                    <th>货号</th>
                    <th>价格</th>
                    <th>数量</th>
                    <th>库存</th>
                    <th>小计</th>
                </tr>
            <foreach name="goods_list" item="vo">
                <tr>
                    <td>{$vo.goods_name}</td>                    
                    <td>{$vo.goods_sn}</td>
                    <td>{$vo.goods_price}</td>
                    <td>{$vo.goods_number}</td>
                    <td>{$vo.storage}</td>
                    <td>{$vo.formated_subtotal}</td>
                </tr>
            </foreach>  
                <tr>
                    <td></td>                    
                    <td></td>
                    <td></td>
                    <td></td>
                    <td><strong>合计：</strong></td>
                    <td>￥{$p_list.goods_amount}</td>
                </tr>                       
            </thead>
        </table>         
    </div>
    <?php } ?>
     
<br>
    <?php if(isset($p_list)) { ?>
    <div class = "col-md-10">
        <table align="right" class="table table-hover table-list">
            <thead>
                <tr>
                    <th>费用信息</th>
                </tr>
                <tr>
                    <td><span style="float: right;">商品总金额：￥{$p_list.goods_amount} </span></td> 
                </tr>  
                <tr>
                    <td><span style="float: right;">应付金额：￥{$p_list.order_amount}</span></td> 
                </tr>                                  
            </thead>        
        </table>
    </div>
    <br>
    <table align="right" class="table table-hover table-list">
        <thead>
            <tr>

                <td>
                    <div>
                       
                    <?php if($p_list['order_status'] == 0 && $p_list['order_status'] == 0 && $p_list['shipping_status'] == 0){ ?> 
                     <div style="float:left;margin-top:7px"><strong>当前可执行操作：</strong></div>
                        <a href="{:cmf_plugin_url('QbtOrder://AdminIndex/pay?order_id='.$p_list.order_id)}" class="btn btn-primary">付款</a>
                        <a href="{:cmf_plugin_url('QbtOrder://AdminIndex/quxiao?order_id='.$p_list.order_id)}" class="btn btn-primary">取消</a>
                    <?php } ?>    

                    <?php if($p_list['order_status'] == 2 || $p_list['order_status'] == 3){ ?> 
                     <div style="float:left;margin-top:7px"><strong>当前可执行操作：</strong></div>
                        <a href="{:cmf_plugin_url('QbtOrder://AdminIndex/del_order?order_id='.$p_list.order_id)}" class="btn btn-primary">移除</a>
                    <?php } ?>        

                    <?php if($p_list['shipping_status'] == 1 && $p_list['pay_status'] == 2 && $p_list['order_status'] == 1) { ?>
                     <div style="float:left;margin-top:7px"><strong>当前可执行操作：</strong></div>
                        <a href="{:cmf_plugin_url('QbtOrder://AdminIndex/receive?order_id='.$p_list.order_id)}" class="btn btn-primary" >已收货</a>  
                    <?php } ?>

                    <?php if($p_list['shipping_status'] == 0 && $p_list['pay_status'] == 2 && $p_list['order_status'] == 1) { ?>
                    <form action="{:cmf_plugin_url('QbtOrder://AdminIndex/confirmReceipt')}" method="post">
                         <div style="float:left;margin-top:7px"><strong>当前可执行操作：</strong></div>
                        <div style="float:left"><input class="form-control" type="text" name="invoice_no" style="width: 200px;" value="" placeholder="请输入发货单号"></div>
                        <input type="hidden" name="order_id" value="{$p_list.order_id}">
                        <div style="float:left">
                            <input type="submit" class="btn btn-primary fahuo" value="快速发货">
                        </div>
                    </form>    
                    </div>
                    <?php } ?>                                        
                </td>
            </tr>                                 
        </thead>        
    </table>
    <?php } ?>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
<script>
</script>
</body>
</html>